package cn.accp.carFactory;

import java.util.Scanner;

import cn.accp.carFactory.base.Car;
import cn.accp.carFactory.base.impl.Passat;
import cn.accp.carFactory.base.impl.Skoda;

public class Workshop {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int choice;
		do {
			System.out.println("请选择汽车类型：");
			System.out.println("1.斯柯达");
			System.out.println("2.帕萨特");
			System.out.println("3.游戏退出");
			choice = input.nextInt();
		} while (choice < 1 || choice > 3);
		if (choice == 5) {
			System.out.println("退出了，再见！");
		} else {
			Car car = creatCar(choice);
			car.start();
			car.complete();
			System.out.println(car.toString());
		}
	}

	public static Car creatCar(int flag) {
		switch (flag) {
		case 1:
			return new Skoda();
		case 2:
			return new Passat();
		default:
			return null;
		}
	}

}
